const user = {
  state: {
    userInfo: uni.getStorageSync("userInfo") || {},
    token: uni.getStorageSync("token")
  },
  mutations: {
    SET_USERINFO(state, data) {
      state.userInfo = data
			uni.setStorageSync("userInfo",data)
    },
    SET_TOKEN(state, data) {
      state.token = data
			uni.setStorageSync("token",data)
    },
  },
  actions: {
    setUserInfo({
      commit
    }, data) {
      commit('SET_USERINFO', data)
    },
    setToken({
      commit
    }, data) {
      commit('SET_TOKEN', data)
    }
  }
}

export default user